#pragma once
#include <stx/core/all.hpp>

GLOBAL_VAR(gTestCases__, Atomic<std::deque<Task>>{});

int addTestCase__(Task fn_test, std::string_view sv_name)
{
    auto const fn_ = [=]()
    {
        xout("Run Test Case: "sv, sv_name);
        fn_test();
    };

    gTestCases__().visit([fn_](auto& test_cases) { insert(test_cases, fn_); });
    return 0;
}

#define TEST_CASE(name)                                                  \
    void                        name();                                  \
    [[maybe_unused]] auto const MACRO_CONCAT(test___case___unique_id___, \
                                             name) = []                  \
    { return addTestCase__(name, #name##sv); }();                        \
    void name()
